import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {LayoutComponent} from "./pages/layout.component";
import {LeaveHomeGuard} from "./guards/leaveHome.guard";


const appRoutes: Routes = [
    {
        path: '',
        component: LayoutComponent,
        children: [{
            path: '',
            redirectTo: 'home',
            pathMatch: 'full'
        }, {//首页
            path: 'home',
            loadChildren: './pages/home.module#HomeModule',
        }, {//分类页
            path: 'cate/:id',
            loadChildren: './pages/cate.module#CateModule',
        }, {//文章详情页
            path: 'article/:id',
            loadChildren: './pages/article.module#ArticleModule',
        }]
    }];


@NgModule({
    imports: [
        RouterModule.forRoot(appRoutes)
    ],
    exports: [
        RouterModule
    ]
})


export class RoutingModule {
}
